// 权限问题后期增加
import { get, post } from '/@/utils/http/axios';
import { UserState } from '/@/store/modules/user/types';
// import axios from 'axios';
enum URL {
    userLogin = 'login/',
    userRegister = 'register/',
    detail = '/myapp/index/user/info',
    updateUserPwd = 'changepwd/',
    listUserinfo='listUserinfo/',
    updateUserInfo = 'update/',
    delete="userLogout/"
}
interface LoginRes {
    token: string;
}

export interface LoginData {
    username: string;
    password: string;
}
const deleteUserApi = async (params: any) => post<any>({ url: URL.delete, params: params, headers: {} });
const listUserinfoApi = async (params: any) => get<any>({ url: URL.listUserinfo, params: params, data: {}, headers: {} });
const detailApi = async (params: any) => get<any>({ url: URL.detail, params: params, data: {}, headers: {} });
const userLoginApi = async (data: LoginData) => post<any>({ url: URL.userLogin, data, headers: { 'Content-Type': 'multipart/form-data;charset=utf-8' } });
const userRegisterApi = async (data: any) => post<any>({url: URL.userRegister, data: data});
const updateUserPwdApi = async (params: any, data: any) => post<any>({url: URL.updateUserPwd, data: data});
const updateUserInfoApi = async (params: any, data: any) => post<any>({
    url: URL.updateUserInfo,
    params: params,
    data: data,
    headers: {'Content-Type': 'multipart/form-data;charset=utf-8'}
});

export { deleteUserApi,listUserinfoApi,detailApi, userLoginApi, userRegisterApi, updateUserPwdApi, updateUserInfoApi };
